import { defineStore } from 'pinia'
export const useDemoStore = defineStore('demo', {
  persist: {
    enabled: true, //开启缓存
    strategies: [
      {
        // 缓存的模块名称
        key: "erp",
        // 保存位置，默认保存在sessionStorage
        storage: sessionStorage,
        // 缓存哪些状态
        // paths: ["state",'token']
      }
    ]
  },
  state: () => {
    return {
      state: false,
      token: '',
      usemame: '',
      UserGroupName: '',
      userId:'',
      type: '',
      tabList:[],
      lang:'en-us'
    }
  },
  getters: {},
  actions: {
    changeState(newState) {
      this.state = newState;
    },
    changeToken(newToken) {
      this.token = newToken;
    },
    changeUsemame(newUsemame) {
      this.usemame = newUsemame;
    },
    changeName(newName) {
      this.UserGroupName = newName;
    },
    changeType(newType) {
      this.type = newType
    },
    changeUser(newUser) {
      this.userId = newUser
    },
    changeTab(newTab) {
      this.tabList = newTab
    },
    changeLang(newLang) {
      this.lang = newLang
    }
  }
})